#将一个请求封装为一个对象，从而使你可用不同的请求对客户进行参数化
class Request:
    def Get(self):
        print('Get')
        pass
    def Post(self):
        print('Post')
        pass
    
class Command(object):
    def __init__(self,res):
        print('init  Command')
        self.request = res
        pass
    def excuteCommand(self):
        pass

class GetCommand(Command):
    def __init__(self,res):
        super().__init__(res)
        pass
    def excuteCommand(self):
        self.request.Get()
        pass

class PostCommand(Command):
    def __init__(self,res):
        super().__init__( res)
        pass
    def excuteCommand(self):
        self.request.Post()
        pass

class Excutor :
    def __init__(self): 
        self.comm=None
        pass

    def setOrder(self,comm):
        self.comm=comm
        pass
    def modify(self):
        self.comm.excuteCommand()
        pass
    
if __name__ == "__main__":
    boy = Request()
    
    get    =  GetCommand(boy)
    post  =  PostCommand(boy)
    
    girl = Excutor()
    
    girl.setOrder(get)
    girl.modify()
    
    girl.setOrder(post)
    girl.modify()
    